\(\int (a+b \cos (c+d x)) (B \cos (c+d x)+C \cos ^2(c+d x)) \sec (c+d x) \, dx\) [772]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 36, antiderivative size = 52 \[ \int (a+b \cos (c+d x)) \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {1}{2} (2 a B+b C) x+\frac {(b B+a C) \sin (c+d x)}{d}+\frac {b C \cos (c+d x) \sin (c+d x)}{2 d} \]

[Out]

1/2*(2*B*a+C*b)*x+(B*b+C*a)*sin(d*x+c)/d+1/2*b*C*cos(d*x+c)*sin(d*x+c)/d

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 52, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.056, Rules used = {3108, 2813} \[ \int (a+b \cos (c+d x)) \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {(a C+b B) \sin (c+d x)}{d}+\frac {1}{2} x (2 a B+b C)+\frac {b C \sin (c+d x) \cos (c+d x)}{2 d} \]

[In]

Int[(a + b*Cos[c + d*x])*(B*Cos[c + d*x] + C*Cos[c + d*x]^2)*Sec[c + d*x],x]

[Out]

((2*a*B + b*C)*x)/2 + ((b*B + a*C)*Sin[c + d*x])/d + (b*C*Cos[c + d*x]*Sin[c + d*x])/(2*d)

Rule 2813

Int[((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(2*a*c +
 b*d)*(x/2), x] + (-Simp[(b*c + a*d)*(Cos[e + f*x]/f), x] - Simp[b*d*Cos[e + f*x]*(Sin[e + f*x]/(2*f)), x]) /;
 FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0]

Rule 3108

Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)])^(n_.)*((A_.) + (B_.)
*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Dist[1/b^2, Int[(a + b*Sin[e + f*x])
^(m + 1)*(c + d*Sin[e + f*x])^n*(b*B - a*C + b*C*Sin[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, m,
 n}, x] && NeQ[b*c - a*d, 0] && EqQ[A*b^2 - a*b*B + a^2*C, 0]

Rubi steps \begin{align*} \text {integral}& = \int (a+b \cos (c+d x)) (B+C \cos (c+d x)) \, dx \\ & = \frac {1}{2} (2 a B+b C) x+\frac {(b B+a C) \sin (c+d x)}{d}+\frac {b C \cos (c+d x) \sin (c+d x)}{2 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.08 (sec) , antiderivative size = 51, normalized size of antiderivative = 0.98 \[ \int (a+b \cos (c+d x)) \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {2 b c C+4 a B d x+2 b C d x+4 (b B+a C) \sin (c+d x)+b C \sin (2 (c+d x))}{4 d} \]

[In]

Integrate[(a + b*Cos[c + d*x])*(B*Cos[c + d*x] + C*Cos[c + d*x]^2)*Sec[c + d*x],x]

[Out]

(2*b*c*C + 4*a*B*d*x + 2*b*C*d*x + 4*(b*B + a*C)*Sin[c + d*x] + b*C*Sin[2*(c + d*x)])/(4*d)

Maple [A] (verified)

Time = 1.36 (sec) , antiderivative size = 51, normalized size of antiderivative = 0.98

method result size
risch \(a B x +\frac {b C x}{2}+\frac {b B \sin \left (d x +c \right )}{d}+\frac {a C \sin \left (d x +c \right )}{d}+\frac {\sin \left (2 d x +2 c \right ) C b}{4 d}\) \(51\)
parallelrisch \(\frac {4 B a d x +2 b x d C +4 B \sin \left (d x +c \right ) b +4 a \sin \left (d x +c \right ) C +b \sin \left (2 d x +2 c \right ) C}{4 d}\) \(51\)
derivativedivides \(\frac {C b \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+B \sin \left (d x +c \right ) b +a \sin \left (d x +c \right ) C +B a \left (d x +c \right )}{d}\) \(57\)
default \(\frac {C b \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )+B \sin \left (d x +c \right ) b +a \sin \left (d x +c \right ) C +B a \left (d x +c \right )}{d}\) \(57\)
parts \(\frac {\left (B b +a C \right ) \sin \left (d x +c \right )}{d}+\frac {B a \left (d x +c \right )}{d}+\frac {C b \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) \(58\)
norman \(\frac {\left (B a +\frac {C b}{2}\right ) x +\left (B a +\frac {C b}{2}\right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (3 B a +\frac {3 C b}{2}\right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\left (3 B a +\frac {3 C b}{2}\right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {\left (2 B b +2 a C -C b \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}+\frac {\left (2 B b +2 a C +C b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {4 \left (B b +a C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{3}}\) \(169\)

[In]

int((a+cos(d*x+c)*b)*(B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c),x,method=_RETURNVERBOSE)

[Out]

a*B*x+1/2*b*C*x+b*B*sin(d*x+c)/d+a*C*sin(d*x+c)/d+1/4/d*sin(2*d*x+2*c)*C*b

Fricas [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 42, normalized size of antiderivative = 0.81 \[ \int (a+b \cos (c+d x)) \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {{\left (2 \, B a + C b\right )} d x + {\left (C b \cos \left (d x + c\right ) + 2 \, C a + 2 \, B b\right )} \sin \left (d x + c\right )}{2 \, d} \]

[In]

integrate((a+b*cos(d*x+c))*(B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c),x, algorithm="fricas")

[Out]

1/2*((2*B*a + C*b)*d*x + (C*b*cos(d*x + c) + 2*C*a + 2*B*b)*sin(d*x + c))/d

Sympy [F]

\[ \int (a+b \cos (c+d x)) \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\int \left (B + C \cos {\left (c + d x \right )}\right ) \left (a + b \cos {\left (c + d x \right )}\right ) \cos {\left (c + d x \right )} \sec {\left (c + d x \right )}\, dx \]

[In]

integrate((a+b*cos(d*x+c))*(B*cos(d*x+c)+C*cos(d*x+c)**2)*sec(d*x+c),x)

[Out]

Integral((B + C*cos(c + d*x))*(a + b*cos(c + d*x))*cos(c + d*x)*sec(c + d*x), x)

Maxima [A] (verification not implemented)

none

Time = 0.23 (sec) , antiderivative size = 55, normalized size of antiderivative = 1.06 \[ \int (a+b \cos (c+d x)) \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {4 \, {\left (d x + c\right )} B a + {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} C b + 4 \, C a \sin \left (d x + c\right ) + 4 \, B b \sin \left (d x + c\right )}{4 \, d} \]

[In]

integrate((a+b*cos(d*x+c))*(B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c),x, algorithm="maxima")

[Out]

1/4*(4*(d*x + c)*B*a + (2*d*x + 2*c + sin(2*d*x + 2*c))*C*b + 4*C*a*sin(d*x + c) + 4*B*b*sin(d*x + c))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 121 vs. \(2 (48) = 96\).

Time = 0.31 (sec) , antiderivative size = 121, normalized size of antiderivative = 2.33 \[ \int (a+b \cos (c+d x)) \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=\frac {{\left (2 \, B a + C b\right )} {\left (d x + c\right )} + \frac {2 \, {\left (2 \, C a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2 \, B b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - C b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2 \, C a \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 2 \, B b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + C b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1\right )}^{2}}}{2 \, d} \]

[In]

integrate((a+b*cos(d*x+c))*(B*cos(d*x+c)+C*cos(d*x+c)^2)*sec(d*x+c),x, algorithm="giac")

[Out]

1/2*((2*B*a + C*b)*(d*x + c) + 2*(2*C*a*tan(1/2*d*x + 1/2*c)^3 + 2*B*b*tan(1/2*d*x + 1/2*c)^3 - C*b*tan(1/2*d*
x + 1/2*c)^3 + 2*C*a*tan(1/2*d*x + 1/2*c) + 2*B*b*tan(1/2*d*x + 1/2*c) + C*b*tan(1/2*d*x + 1/2*c))/(tan(1/2*d*
x + 1/2*c)^2 + 1)^2)/d

Mupad [B] (verification not implemented)

Time = 1.83 (sec) , antiderivative size = 50, normalized size of antiderivative = 0.96 \[ \int (a+b \cos (c+d x)) \left (B \cos (c+d x)+C \cos ^2(c+d x)\right ) \sec (c+d x) \, dx=B\,a\,x+\frac {C\,b\,x}{2}+\frac {B\,b\,\sin \left (c+d\,x\right )}{d}+\frac {C\,a\,\sin \left (c+d\,x\right )}{d}+\frac {C\,b\,\sin \left (2\,c+2\,d\,x\right )}{4\,d} \]

[In]

int(((B*cos(c + d*x) + C*cos(c + d*x)^2)*(a + b*cos(c + d*x)))/cos(c + d*x),x)

[Out]

B*a*x + (C*b*x)/2 + (B*b*sin(c + d*x))/d + (C*a*sin(c + d*x))/d + (C*b*sin(2*c + 2*d*x))/(4*d)